var events = require('events');
var http = require('htpp');

function UserBean() {
	this.eventEmit = new events.eventEmitter();
	this.zhuce = function(req, res) {
		console.log('注册');
		req['uname'] = 'aa';
		req['pwd'] = 'bbb';
		this.eventEmit.emit('zhuceSuc', 'aa', 'bbb');
 	},
	this.login = function(req, res){
		console.log('登录');
		res.write('用户名：' + req['uname']);
		res.write('密码：' + req['qwd']);
		res.write('登录');
	}
};

module.exports = UserBean;


/*    
Events    
        events.EventEmitter    
		emitter.addListener(event, listener)==on //添加监听    
		emitter.on(event, listener)    
		emitter.once(event, listener)//一次性的监听器    
		emitter.removeListener(event, listener) //删除指定监听    
		emitter.removeAllListeners([event]) //删除所有监听    
		emitter.setMaxListeners(n) //默认情况下当一个事件的监听超过10个时，EventEmitter 将打印警告信息，0表无限制    
		emitter.listeners(event) //返回特定事件的事件监听器集合    
		emitter.emit(event, [arg1], [arg2], [...])  //用提供的参数按顺序执行每个事件监听器。    
*/    



















